package com.xzh.wms.controller;

import com.xzh.wms.entity.Roles;
import com.xzh.wms.entity.User;
import com.xzh.wms.entity.UserQuery;
import com.xzh.wms.entity.UserRole;
import com.xzh.wms.service.UserRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/userRole")
@Slf4j
public class UserRoleController {
    @Autowired
    private UserRoleService userRoleService;

    @GetMapping("/user")
    public List<User> selectUser(UserQuery query){
        return userRoleService.selectUser(query);
    }

    @GetMapping
    public List<Roles> selectRole(Roles roles ) {
        return userRoleService.selectRole( roles);
    }

    @PostMapping
    public Integer insert(@RequestBody UserRole userRole){
        return userRoleService.insert(userRole);
    }

//    @PutMapping
//    public Integer update(@RequestBody Category product){
//        return categoryService.update(product);
//    }
//


    @DeleteMapping
    public Integer delete(@RequestBody UserRole userRole){
        return userRoleService.delete(userRole);
    }
}
